package com.king.designpatterns.创造型模式.工厂模式;

import java.io.IOException;
import java.util.Scanner;

/**
 * 工厂模式应用案例
 *
 * @author king
 * @date 2021-06-05 21:41
 */
public class ClientDemo {
    public static void main(String[] args) throws IOException {
        // 苹果园丁工厂
        FruitGardener fruitGardener = new AppleGardener();
        // 通过工厂生产苹果
        Fruit apple = fruitGardener.factory();
        apple.plant();
        apple.grow();
        apple.harvest();

        // 葡萄园丁工厂
        fruitGardener = new GrapeGardener();
        // 通过工厂生产葡萄
        Fruit grape = fruitGardener.factory();
        grape.plant();
        grape.grow();
        grape.harvest();
    }
}
